#include "udp_client.hpp"
#include <iostream>

int main(int argc, char* args[])
{
    if(argc != 3)
    {
        std::cout<< "error~~~~" << std::endl;
        return 1;
    }
    udpclient client(args[1], atoi(args[2]));
    for(;;)
    {
        std::string word;
        std::cout << "请输入你要查的单词" << std::endl;
        std::cin >>word;
        if(!std::cin)
        {
            std::cout << "Good bye" << std::endl;
            break;
        }
        client.Sendto(word);
        std::string result;
        client.Recvfrom(&result);
        std::cout << word << " means:" << result << std::endl;
    }
    return 0;
}